package com.ljfiction.book.Dialog;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;


import com.ljfiction.book.MyView.ThreeBallRotationProgressBar;
import com.ljfiction.book.R;

import java.util.Objects;



public class LoadviewDialog extends Dialog{

private ThreeBallRotationProgressBar threeBallRotationProgressBar;
    public LoadviewDialog(@NonNull Context context) {
        super(context);

        View view = LayoutInflater.from(context).inflate(R.layout.loadview, null);
        threeBallRotationProgressBar=view.findViewById(R.id.threeball);
        setContentView(view);
        getWindow().setBackgroundDrawableResource(android.R.color.transparent);
        getWindow().clearFlags( WindowManager.LayoutParams.FLAG_DIM_BEHIND);
       Objects.requireNonNull(getWindow()).setGravity(Gravity.CENTER);
        setCanceledOnTouchOutside(false);
        setCancelable(false);


    }

    @Override
    public void setOnDismissListener(@Nullable OnDismissListener listener) {
        super.setOnDismissListener(listener);
        threeBallRotationProgressBar=null;
    }
    /* public void  show(){
        if (dialog!=null){
            dialog.show();
        }
    }
    public void  dismiss(){
        if (dialog!=null){
            dialog.dismiss();
            dialog=null;
        }
    }*/
}
